package com.max.xihu.patterns.proxy;

/**
 * @Author: Max
 * @Date: 2020-09-10 08:22
 * @Description:
 */
public class Proxy implements Subject{

    private Subject subject = null;

    //默认被代理者
    public Proxy(){
        this.subject = new Proxy();
    }

    //通过构造函数传递代理者
    public Proxy(Object...objects){

    }

    public Proxy(Subject subject){
        this.subject = subject;
    }


    @Override
    public void request() {
        before();
        this.subject.request();
        after();
    }

    private void before(){
        System.out.println("前置处理");
    }

    private void after(){
        System.out.println("后置处理");
    }
}
